home *** CD-ROM | disk | FTP | other *** search
/ Radio Active - The Music Trivia Game Show / Radio Active - The Music Trivia Game Show (1994)(Sanctuary Woods).iso / radactiv / radactiv.dir / 00268_Field_268.txt < prev    next >
Text File  |  1994-11-20  |  2KB  |  88 lines

  1. FILE IO HANDLERS
  2.  
  3. --
  4.   
  5. on readTextFile
  6.   global file, FileIO
  7.   set file = FileIO(mNew, "?read", "TEXT")
  8.   if not objectp(file) then exit
  9.   set the text of cast a21 to " "
  10.   go to frame "Read"
  11.   
  12. on readLine
  13.   global file
  14.   set s = file(mreadline)
  15.   if s <> "" then
  16.     set the text of cast a21 to s
  17.   else
  18.     alert "That is the last line of the file." & return & "Click Done to exit."
  19.   end if
  20.   
  21.   
  22. on finishRead
  23.   global file
  24.   file(mDispose)
  25.   set the text of cast a21 to " "
  26.   go to frame "menu"
  27.   
  28. on writeTextFile
  29.   global file, FileIO
  30.   set file = FileIO(mNew, "?write", "File I/O Write Test" )
  31.   if not objectp( file ) then 
  32.     set theProblem = string( file )
  33.     checkError
  34.     exit
  35.   end if
  36.   set the text of cast a21 to " "
  37.   go to frame "Write"
  38.   when keyDown then stringEntry
  39.   
  40. on appendTextFile
  41.   global file, FileIO, theProblem
  42.   set file = FileIO(mNew, "?append", "TEXT" )
  43.   if not objectp( file ) then 
  44.     set theProblem = string( file )
  45.     checkError
  46.     exit
  47.   end if
  48.   set the text of cast a21 to " "
  49.   go to frame "Write"
  50.   when keyDown then stringEntry
  51.   
  52. on checkError
  53.   global theProblem
  54.   if theProblem = -43 then exit  --  the user clicked Cancel; no need to alert them
  55.   else alert "FileIO object was not made." & return & return &┬¼
  56.     "Error: " & string( theProblem )
  57.   
  58. on stringEntry
  59.   if the key = Return then
  60.     dontPassEvent 
  61.     writeString
  62.   end if
  63.   
  64. on writeString
  65.   global file
  66.   set s to the text of cast a21
  67.   file( mWriteString, string( s ) & return )
  68.   set the text of cast a21 to " "
  69.   set the selStart = 0
  70.   set the selEnd = 1000
  71.   
  72. on finishWrite
  73.   global file
  74.   file(mDispose)
  75.   set the text of cast a21 to " "
  76.   when keyDown then nothing  
  77.   go to frame "menu"
  78.   
  79. on doAbout
  80.   global file
  81.   if objectp( file ) <> 0 then file(mdispose)
  82.   set the text of cast a21 to " "
  83.   go to frame "About"
  84.   
  85. on doneFile
  86.   global file
  87.   if objectp( file ) <> 0 then file(mdispose)
  88.   go to frame "xobj" of movie "ΓÇóMain Menu"